/***********************************************************************
 ** Reykjavik University
 ** Grímur Tómasson & Eiríkur Fannar Torfason
 ** Copyright (c) 2011. All rights reserved.
 **********************************************************************/


#ifndef ITERATIVE_DEEPENING_ALPHA_BETA_SEARCH_
#define ITERATIVE_DEEPENING_ALPHA_BETA_SEARCH_

#include "bitboard.h"

//----------------------------------------------------------------------------------------------------------

void* iterativeDeepeningAlphaBetaSearch( void* idAlphaBetaParameters );

//----------------------------------------------------------------------------------------------------------
//
// This struct encompasses the parameters for an iteratively deepening AB search. Wrapping them up like this
// makes it possible to run the search on a separate thread but then retrieve the values from the parent
// thread.
//
struct IDAlphaBetaParameters 
{
	bitboard* bitboardArray_[2]; 
	int currentPly_; 
	int depthLimit_; 
	int timeLimitMilliseconds_;
	int expanded_;
	int milliseconds_;
	int bestMove_;
	int depthReached_;
	int abort_;
	int (*ptr2UtilityFunction)(bitboard**, int*, int );
	
	IDAlphaBetaParameters( bitboard* bitboardArray[], int currentPly, int depthLimit, int timeLimitMilliseconds )
	{
		bitboardArray_[0] = bitboardArray[0];
		bitboardArray_[1] = bitboardArray[1];
		currentPly_ = currentPly;
		depthLimit_ = depthLimit;
		timeLimitMilliseconds_ = timeLimitMilliseconds;
		expanded_ = 0;
		milliseconds_ = 0;
		bestMove_ = -1;
		depthReached_ = 0;
		abort_ = 0;
	}	
};
//----------------------------------------------------------------------------------------------------------

#endif